// File Name: beep_ctrl.h
// Author: kukukukuku~
// Date: 2024-06-25

#ifndef __BEEP_CTRL_H
#define __BEEP_CTRL_H

#include "at32f421.h"

#define BEEP_GPIO_CRM           CRM_GPIOA_PERIPH_CLOCK
#define BEEP_GPIO_PORT          GPIOA
#define BEEP_GPIO_PIN           GPIO_PINS_15

#define BEEP_TMR_CRM            CRM_TMR6_PERIPH_CLOCK
#define BEEP_TMR                TMR6
#define BEEP_TMR_DIV            (120)
#define BEEP_TMR_PR             (1000)
#define BEEP_TMR_IRQ            TMR6_GLOBAL_IRQn
#define BEEP_TMR_HANDLE         TMR6_GLOBAL_IRQHandler

#define BEEP_ENA                (1)
#define BEEP_DISA               (0)

#define BEEP_ALARM_MIN          (10)    //Beep警告最短时间(ms)
#define BEEP_ALARM_MAX          (5000)  //Beep警告最长时间(ms)

extern uint16_t beepOnMsCnt;   //蜂鸣器打开时间计数

//打开Beep
void beep_on(void);

//关闭Beep
void beep_off(void);

//Beep配置
void beep_config(void);

#endif //__BEEP_CTRL_H
